#ifndef __RECORD_H_
#define __RECORD_H_


#include <attribute.h>
#include <globalDecl.h>
#include <schema.h>
#include <vector>

class Record
{
	protected:
		//Attribute *m_aMyAtts;
		vector<Attribute> m_vMyAtts;
		int m_iNumAtts;
		Schema * m_oFileSchema;
	public:

		Record ();
        ~Record();
		void SetFree();
        // prints the contents of the record to the screen; this requires
        // that the schema also be given so that the record can be interpreted
        void Print (Schema &mySchema);

        // reads the next record from a pointer to a text file; also requires
        // that the schema be given; returns a 0 if there is no data left or
        // if there is an error and returns a 1 otherwise
        int SuckNextRecord (Schema &mySchema, FILE *textFile);

        // suck the contents of the record fromMe into this; note that after
        // this call, fromMe will no longer have anything inside of it
		// and fromMe.myAtts should be 0
        void Consume (Record &fromMe);

        // make a copy of the record fromMe; note that this is far more
        // expensive (requiring a bit-by-bit copy) than Consume, which is
        // only a pointer operation
        void Copy (Record &copyMe);

		// write the record in a "flat" format to the specified memory location;
		// returns the length of the record, in bytes
		int ToBinary (char *writeToHere);

		// read the record from the flat, binary format; returns the number of
		// bytes that were read
		int FromBinary (char *readFromHere);

		// this returns the number of bytes that would be needed to store the
		// record in a flat format
		int HowManyBytes ();
		void declareAtts(int _sizeSchema);
		int Compare(Attribute at,int _place,int _compare,Type _ty);
};

#endif

